package com.ycz.commons;/*
 @author ycz
 @date 2021-11-19-10:35
*/

import com.ycz.commons.exception.BussiException;
import jdk.nashorn.tools.Shell;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data


public class Result {

    private Integer code;

    private String msg;

    private Object data;

    public Result (){
        this.code = CodeMsg.SUCCESS.code;
        this.msg = CodeMsg.SUCCESS.msg;
    }

    public Result(Object data) {
        this();
        this.data = data;
    }

    public Result(CodeMsg codeMsg) {
        this.code = codeMsg.code;
        this.msg = codeMsg.msg;
    }
    /**
     * 兼容异常信息
     *
     * @param bussiException
     */
    public Result(BussiException bussiException) {
        this.code = bussiException.getCode();
        this.msg = bussiException.getMessage();
    }



}
